package org.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.example.entity.system.Role;

import java.util.List;
import java.util.Map;

/**
 * @author 魏锴
 * @description 针对表【tb_sys_role】的数据库操作Mapper
 * @createDate 2024-01-11 15:16:59
 * @Entity org.example.entity.system.Role
 */
public interface RoleMapper extends BaseMapper<Role> {
    boolean insertRole(Role role);

    boolean updateRole(Role role);

    boolean deleteRole(int id);

    List<Role> getRoleList();

    List<Integer> getRoleIdList();

    List<Integer> getRolesByUser(int user_id);

    Role getRoleById(int role_id);//根据角色名获得角色信息

    Role getRoleByIdWithPerm(int role_id);//根据角色名获得角色信息
    @MapKey("id")
    List<Map<String,Object>> getRoleIdMap();

    boolean grantRole(@Param("user_id") int user_id,@Param("role_id") int role_id);

    boolean revokeRole(@Param("user_id") int user_id,@Param("role_id") int role_id);
}




